<template>
  <div>
    <Table :columns="columns" :data="data" size="small" border />
  </div>
</template>

<script>
export default {
  name: 'ProjectInfoTable',
  props: {
    data: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      columns: [
        { title: '项目名称', key: 'name', minWidth: 200 },
        { title: '项目状态', slot: 'status', align: 'center', width: 100 },
        { title: '完成进度', slot: 'progress', align: 'center', width: 120 },
        { title: '项目经理', key: 'leader', align: 'center', width: 100 },
        { title: '负责部门', key: 'department', align: 'center', width: 100 },
        { title: '开始时间', key: 'start_time', align: 'center', width: 120 },
        { title: '结束时间', key: 'end_time', align: 'center', width: 120 },
        { title: '操作', slot: 'action', fixed: 'right', width: 120, align: 'center' }
      ]
    };
  },
  methods: {
    getStatusText(status) {
      const statusMap = {
        0: '未开始',
        1: '进行中',
        2: '已完成',
        3: '已暂停'
      };
      return statusMap[status] || '未知';
    },
    getStatusColor(status) {
      const colorMap = {
        0: 'default',
        1: 'blue',
        2: 'success',
        3: 'orange'
      };
      return colorMap[status] || 'default';
    }
  }
};
</script>

<template slot-scope="{ row, index }" slot="status">
  <Tag :color="getStatusColor(row.status)" size="small">{{ getStatusText(row.status) }}</Tag>
</template>

<template slot-scope="{ row, index }" slot="progress">
  <Progress :percent="row.progress || 0" :stroke-width="8" />
</template>

<template slot-scope="{ row, index }" slot="action">
  <!-- <Button size="small" type="primary" @click="editProject(row)">编辑</Button>
  <Button size="small" type="error" @click="deleteProject(row)">删除</Button> -->
</template> 